package com.lcredu.springbootusersys.servlet;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author 黎长容
 * @date 2025-08-17 16:09
 */
@Slf4j
//@WebFilter(urlPatterns = {"/css/*", "/images/*"})
public class Filter_ implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("filterConfig---start()");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        log.info("doFilter---start()");
        HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
        log.info("filter过滤的请求是---" + httpServletRequest.getRequestURI());
        //放行
        filterChain.doFilter(servletRequest, servletResponse);


    }

    @Override
    public void destroy() {
        log.info("destroy()---start()");
    }
}
